﻿using HelloOne.NewsSvc.Infrastructure;
using HelloOne.Repositories;
using System;

namespace HelloOne.NewsSvc.Models
{
    /// <summary>
    /// 菜单
    /// </summary>
    public class Menu : IEntity
    {
        public Menu()
        {
            ID = Guid.NewGuid();
            CreatedDate = DateTime.Now;
            UpdatedDate = DateTime.Now;
            IsDeleted = false;
        }
        public Menu(string name, int sort) : this()
        {
            Name = name;
            Sort = sort;
        }
        #region 属性
        public Guid ID { get; set; }
        public string Name { get; set; }
        public int Sort { get; set; }
        public Menu ParentMenu { get; set; }
        /// <summary>
        /// 菜单类型
        /// </summary>
        public MenuCategory MenuCategory { get; set; }
        public DateTime CreatedDate { get; set; }
        public DateTime UpdatedDate { get; set; }
        public bool IsDeleted { get; set; }
        #endregion
    }


    /// <summary>
    /// 菜单类型
    /// </summary>
    public class MenuCategory : IEntity
    {
        public MenuCategory()
        {
            ID = Guid.NewGuid();
            CreatedDate = DateTime.Now;
            UpdatedDate = DateTime.Now;
            IsDeleted = false;
        }
        public MenuCategory(Guid menuID, MenuCategoryEnum menuCategoryEnum, string value) : this()
        {
            this.MenuID = menuID;
            this.MenuCategoryEnum = menuCategoryEnum;
            this.Value = value;
        }
        public Guid ID { get; set; }
        public Guid MenuID { get; set; }
        public MenuCategoryEnum MenuCategoryEnum { get; set; }
        public string Value { get; set; }
        public DateTime CreatedDate { get; set; }
        public DateTime UpdatedDate { get; set; }
        public bool IsDeleted { get; set; }
    }

    ///// <summary>
    ///// 菜单类型枚举
    ///// </summary>
    public enum MenuCategoryEnum
    {
        [EnumDescription("链接")]
        Link = 1,
        [EnumDescription("模板")]
        Template = 2
    }
}